﻿<template>
  <div>
    <h1>异步组件</h1>
    <AsyncChildComponent />
  </div>
</template>

<script>
import { defineAsyncComponent } from 'vue';

const AsyncChildComponent = defineAsyncComponent({
  loader: () => import('./Components/AsyncChildComponent.vue'),
  loadingComponent: {
    template: '<p style="color: red">加载中...</p>'
  },
  errorComponent: {
    template: '<p>加载失败，请重试。</p>'
  },
  delay: 1,
  timeout: 5000
});

export default {
  components: {
    AsyncChildComponent
  }
}
</script>
